From 13dbb4fd446a7f93e63120069480a5a3d416cf20 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 23 Oct 2008 12:01:03 +0100 Subject: [PATCH] hpet cpuidle: Observe IRQ-safe locking protocol. Otherwise, may encounter deadlock. Signed-off-by: Wei Gang Signed-off-by: Keir Fraser --- xen/arch/x86/hpet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 5a660245b6..443d487f67 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -146,7 +146,7 @@ static void handle_hpet_broadcast(struct hpet_event_channel *ch) s_time_t now, next_event; int cpu; - spin_lock(&ch->lock); + spin_lock_irq(&ch->lock); again: ch->next_event = STIME_MAX; @@ -171,7 +171,7 @@ again: if ( reprogram_hpet_evt_channel(ch, next_event, now, 0) ) goto again; } - spin_unlock(&ch->lock); + spin_unlock_irq(&ch->lock); } void hpet_broadcast_init(void) @@ -213,6 +213,7 @@ void hpet_broadcast_enter(void) { struct hpet_event_channel *ch = &hpet_event; + ASSERT(!local_irq_is_enabled()); spin_lock(&ch->lock); disable_APIC_timer(); -- 2.30.2